package com.cbd.service.impl;

import java.util.List;


import java.util.List;


import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cbd.dao.ComplaintrecordDao;
import com.cbd.pojo.Complaintrecord;
import com.cbd.service.ComplaintrecordService;
import com.cbd.util.IQuantity;
@Service
public class ComplaintrecordServiceImpl implements ComplaintrecordService {
	@Resource(name="complaintrecordDaoImpl")
	private ComplaintrecordDao complaintrecordDao;
	
	public void setComplaintrecordDao(ComplaintrecordDao complaintrecordDao) {
		this.complaintrecordDao = complaintrecordDao;
	}

	@Override
	public int addComplaintrecord(Complaintrecord complaintrecord) {
		// TODO Auto-generated method stub
		return complaintrecordDao.addComplaintrecord(complaintrecord);
	}

	@Override
	public int checkIsCompalint(int recordID) {
		// TODO Auto-generated method stub
		return complaintrecordDao.checkIsCompalint(recordID);
	}

	@Override
	public List<Object[]> showLandlady(int page) {
		// TODO Auto-generated method stub
		int count=complaintrecordDao.count();
		List<Object[]>list=complaintrecordDao.showLandlady((page-1)*IQuantity.pageSize);
		int pageSize= count%IQuantity.pageSize==0?count/IQuantity.pageSize:(int)(count/IQuantity.pageSize)+1;
		list.add(new Object[]{pageSize});
		return list;
	}

	@Override
	public List<?> findComplaintInfo(int type, int complaintRecordID) {
		// TODO Auto-generated method stub
		return complaintrecordDao.findComplaintInfo(type, complaintRecordID);
	}

	@Override
	public int updateComplaintrecord(String ispass,int complaint,int complaintrecordID) {
		// TODO Auto-generated method stub
		return complaintrecordDao.updateComplaintrecord(ispass,complaint, complaintrecordID);
	}


}
